package com.example.learn_gl_android

import android.opengl.GLSurfaceView
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.enableEdgeToEdge
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.learn_gl_android.model.TriangleGLSurfaceView2
import com.example.learn_gl_android.ui.theme.LearnglandroidTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

//        enableEdgeToEdge()
//        setContent {
//            LearnglandroidTheme {
//                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
//                    Greeting(
//                        name = "Android",
//                        modifier = Modifier.padding(innerPadding)
//                    )
//                }
//            }
//        }

//        val glView = GLSurfaceView(this)
//        val mRender  = MyRender()
//        glView.setRenderer(mRender)
//        setContentView(glView)

//        val glView = TriangleGLSurfaceView(this)
        val glView = TriangleGLSurfaceView2(this)
        setContentView(glView)
    }
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
    Text(
        text = "Hello $name!",
        modifier = modifier
    )
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    LearnglandroidTheme {
        Greeting("Android")
    }
}